creating an array of arrays or 2D array dynamically
77
int ** arr = malloc(N*sizeof(int *));
for(i=0; i< N; i++) arr[i] = malloc(M*sizeof(int));
/* or you can use this simpler version*/
int (*arr)[M] = malloc(sizeof(int[N][M]));
/* arr is pointer to int[M]
use like arr[0][M-1];
and free(arr);
*/